<?php
/**
 * Created by PhpStorm.
 * User: yellow
 * Date: 2019/6/25
 * Time: 15:17
 */

namespace app\admin\controller;

use app\admin\logic\WishLogic;
use think\facade\Request;

class Wish extends Base
{

    private $WishLogic;

    public function __construct()
    {
        parent::__construct();
        $this->WishLogic = new WishLogic();
    }

    public function apply(){
        $this->assign('id',Request::param('id'));
        return $this->fetch();
    }

    public function apply_list(){
        return $this->fetch();
    }

    public function ajaxApply(){
        $where = Request::param();
        $res = $this->WishLogic->applyList($where, self::$nowPage);
        return json($res);
    }

    public function index(){
        return $this->fetch();
    }

    public function ajaxIndex(){
        $where = Request::param();
        $res = $this->WishLogic->WishList($where, self::$nowPage);
        return json($res);
    }

    public function ajaxApplyList(){
        $where = Request::param();
        $res = $this->WishLogic->WishApplyList($where, self::$nowPage);
        return json($res);
    }

    public function add(){
        $id = Request::get('id');
        $act = 'add';
        if ($id){
            $act = 'edit';
            $cateInfo = $this->WishLogic->info($id);
            $this->assign('info', $cateInfo['data']);
        }
        $this->assign('act', $act);
        return $this->fetch();
    }

    public function handle(){
        $data = Request::param();
        $res = $this->WishLogic->handle($data);
        return json($res);
    }


}